home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln1285.arc / SAMPLE.SCR < prev    next >
Text File  |  1986-02-27  |  3KB  |  1 lines

  1. ( Output of Dada compiler )                                     ( To execute type: 1 LOAD HAILSTONE ) ;S                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        FORTH DEFINITIONS DECIMAL                                       1 CONSTANT TRUE   0 CONSTANT FALSE : NEGATE MINUS ;             : NOT 0= ; : <> = NOT ; : >= < NOT ; : <= > NOT ;               : READ KEY DUP 45 = IF TRUE SWAP EMIT KEY ELSE FALSE SWAP         THEN 0 SWAP BEGIN DUP 13 = NOT WHILE DUP 48 < OVER              57 > OR IF DROP 7 EMIT ELSE DUP EMIT 48 - SWAP 10 * +           THEN KEY REPEAT DROP SWAP IF NEGATE THEN SWAP ! ;             : WRITE @ . CR ; -->                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0 VARIABLE N                                                    0 VARIABLE ODD                                                  : CHECKODD N @ 2 MOD 0 = IF FALSE ODD ! ELSE TRUE ODD ! THEN    ;                                                               : DOWNSTEP N @ 2 / N ! ;                                        : UPSTEP 3 N @ * 1 + N ! ;                                      : NEXTTERM CHECKODD ODD @ IF UPSTEP ELSE DOWNSTEP THEN ;        : HAILSTONE N READ BEGIN N @ 1 > WHILE N WRITE NEXTTERM         REPEAT ;                                                        ;S